Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: QuickTime Components

Previous | Overview | Contents | Next |

Configuration Functions for All Channel Components

Sequence grabber components use channel components to obtain digitized data from external media. Your channel is assigned to a sequence grabber component when the application calls the sequence grabber component's SGNewChannel function, described in the chapter "Sequence Grabber Components" in this book. The sequence grabber component must configure your channel before a preview or record operation. Your channel component must provide a number of functions that allow the sequence grabber to configure the characteristics of your channel. Several of these functions work on any channel component. This section discusses these general channel configuration functions.

In addition, channel components provide functions that are specific to the channel type. The sequence grabber component supplied by Apple uses two types of channel components: video channel components and sound channel components. See "Configuration Functions for Video Channel Components," which begins on Configuration Functions for Video Channel Components , for information about the configuration functions that work only with video channels. See "Configuration Functions for Sound Channel Components," which begins on Configuration Functions for Sound Channel Components , for information about the configuration functions that work only with sound channels.

The SGSetChannelUsage function specifies how your channel is to be used. The sequence grabber component can restrict a channel to use during record or preview operations. In addition, this function allows the sequence grabber component to specify whether your channel plays during a record operation. The SGGetChannelUsage function allows the sequence grabber component to determine a channel's usage.

The SGGetChannelInfo function allows the sequence grabber component to determine some of the characteristics of your channel. For example, this function returns information indicating whether your channel has a visual or an audio representation.

The SGSetChannelPlayFlags function lets the sequence grabber component influence the speed and quality with which your channel plays captured data. The SGGetChannelPlayFlags function allows the sequence grabber component to determine these flag settings.

The SGSetChannelMaxFrames function establishes a limit on the number of frames that your channel component will capture from a channel.

The SGGetChannelMaxFrames function enables the sequence grabber component to determine that limit.

The SGSetChannelRefCon function allows the sequence grabber component to set the value of a reference constant that your component passes to its callback functions (see "Using Callback Functions for Video Channel Components," which begins on Using Callback Functions for Video Channel Components , for information about the callback functions that are supported by video channels).

The SGGetDataRate function allows the sequence grabber component to determine how many bytes of captured data your channel is collecting each second.

The SGGetChannelSampleDescription function allows the sequence grabber to retrieve your channel's sample description. The SGGetChannelTimeScale function allows it to obtain your channel's time scale.

The sequence grabber can modify or retrieve your channel's clipping region by calling the SGSetChannelClip or SGGetChannelClip function, respectively. The sequence grabber can work with your channel's transformation matrix by calling the SGSetChannelMatrix and SGGetChannelMatrix functions.

SGSetChannelUsage

The SGSetChannelUsage function specifies how your channel is to be used by the sequence grabber component.

pascal ComponentResult SGSetChannelUsage (SGChannel c,
                                         long usage);
c
Identifies the channel connection for this operation.

usage
Contains flags specifying how your channel is to be used. The sequence grabber component may set more than one of these flags to 1. It sets unused flags to 0. The following flags are defined by the SeqGrabUsageEnum data type:

seqGrabRecord
Indicates that your channel is to be used during record operations. The sequence grabber component sets this flag to 1 to use a channel for recording.

seqGrabPreview
Indicates that your channel is to be used during preview operations. The sequence grabber component sets this flag to 1 to use a channel for previewing.

seqGrabPlayDuringRecord
Indicates that your component is to play its captured data during a record operation. If the sequence grabber component sets this flag to 1, your channel should play its captured data during a record operation, if the destination buffer is onscreen.

DESCRIPTION

The sequence grabber component can specify that a channel is to be used for recording or previewing, or both. In addition, the sequence grabber component can control whether the data captured by a channel is displayed during the record or preview operation.

RESULT CODES

notEnoughMemoryToGrab

-9403

Insufficient memory for record operation

deviceCantMeetRequest

-9408

Device cannot support grabber

SGGetChannelUsage

The SGGetChannelUsage function allows the sequence grabber to determine how your channel is to be used.

pascal ComponentResult SGGetChannelUsage (SGChannel c,
                                         long *usage);
c
Identifies the channel connection for this operation.

usage
Contains a pointer to a location that is to receive flags specifying how your channel is to be used. You may set more than one of these flags to 1. Set unused flags to 0. The following flags are defined by the SeqGrabUsageEnum data type:

seqGrabRecord
Indicates that your channel is to be used during record operations. Set this flag to 1 if your channel is being used for recording.

seqGrabPreview
Indicates that your channel is to be used during preview operations. Set this flag to 1 if your channel is being used for previewing.

seqGrabPlayDuringRecord
Indicates that your component is to play its captured data during a record operation. Set this flag to 1 if your channel plays its captured data during a record operation.

SEE ALSO

The sequence grabber component establishes your channel's usage by calling your SGSetChannelUsage function, described in the previous section.

SGGetChannelInfo

The SGGetChannelInfo function allows the sequence grabber to determine how a channel's data is represented to the user--as visual or audio data, or both.

pascal ComponentResult SGGetChannelInfo (SGChannel c,
                                          long *channelInfo);
c
Identifies the channel connection for this operation.

channelInfo
Contains a pointer to a long integer that is to receive channel information flags. You may set more than one flag to 1. Set unused flags to 0. The following flags are defined:

seqGrabHasBounds
Indicates that your channel has a visual representation. If you set this flag to 1, the channel has a visual representation. The sequence grabber component may call your SGSetChannelBounds function (described on SGSetChannelBounds ).

seqGrabHasVolume
Indicates that your channel has an audio representation. If you set this flag to 1, the channel has an audio representation. The sequence grabber component may call your SGSetChannelVolume function (described on SGSetChannelVolume ).

seqGrabHasDiscreteSamples
Indicates that the data captured by your channel component is organized into discrete frames. If you set this flag to 1, the sequence grabber component may use the SGSetChannelMaxFrames function (described on SGSetChannelMaxFrames ) to limit the number of frames processed in a record operation or the rate at which those frames are processed. If your channel's data is not organized into frames, set this flag to 0.

SGSetChannelPlayFlags

The SGSetChannelPlayFlags function allows the sequence grabber component to influence the speed and quality with which your channel component displays data from its source.

pascal ComponentResult SGSetChannelPlayFlags (SGChannel c,
                                          long playFlags);
c
Identifies the channel connection for this operation.

playFlags
Specifies a long integer that contains flags and values that influence channel playback. The following values are defined--the sequence grabber component must use one of these values:

channelPlayNormal
Instructs your channel component to use its default playback methodology.

channelPlayFast
Instructs your channel component to sacrifice playback quality in order to achieve the specified playback rate.

channelPlayHighQuality
Instructs your channel component to play the channel's data at the highest possible quality--this option sacrifices playback rate for the sake of image quality. This option may reduce the amount of processor time available to other programs in the computer. This option should not affect the quality of the recorded data, however.

The following flag is defined--the sequence grabber component may use this flag with any of the values defined for this parameter (unused flags are set to 0):

channelPlayAllData
Instructs your channel component to try to play all of the data it captures, even the data that is stored in offscreen buffers. This option is useful when you want to be sure that the user sees as much of the captured data as possible. The sequence grabber component sets this flag to 1 to play all the captured data. The sequence grabber component may combine this flag with any of the values defined for the playFlags parameter.

DESCRIPTION

The SGSetChannelPlayFlags function should not affect the quality of a record operation.

SGGetChannelPlayFlags

The SGGetChannelPlayFlags function allows the sequence grabber component to retrieve the playback control flags that it set with the SGSetChannelPlayFlags function, which is described in the previous section.

pascal ComponentResult SGGetChannelPlayFlags (SGChannel c,
                                          long *playFlags);
c
Identifies the channel connection for this operation.

playFlags
Contains a pointer to a long integer that is to receive flags and values that influence channel playback. The following values are defined:

channelPlayNormal
Your channel component uses its default playback methodology.

channelPlayFast
Your channel component sacrifices playback quality in order to achieve the specified playback rate.

channelPlayHighQuality
Your channel component plays the channel's data at the highest possible quality--this option sacrifices playback rate for the sake of image quality. This option may reduce the amount of processor time available to other programs in the computer. This option should not affect the quality of the recorded data, however.

The following flag is defined--this flag may be used with any of the values defined for this parameter (unused flags are set to 0):

channelPlayAllData
Your channel component tries to play all of the data it captures, even the data that is stored in offscreen buffers. This option is useful when you want to be sure that the user sees as much of the captured data as possible. The sequence grabber component sets this flag to 1 to play all the captured data. The sequence grabber component may combine this flag with any of the values defined for the playFlags parameter.

SGSetChannelMaxFrames

The SGSetChannelMaxFrames function allows the sequence grabber to limit the number of frames that your channel component will capture during a record operation.

pascal ComponentResult SGSetChannelMaxFrames (SGChannel c,
                                          long frameCount);
c
Identifies the channel connection for this operation.

frameCount
Specifies the maximum number of frames to capture during the preview or record operation. The sequence grabber component sets this parameter to -1 to remove the limit.

DESCRIPTION

The SGSetChannelMaxFrames function works only with channels that have data that is organized into frames, such as video data from a video disc.

RESULT CODES

paramErr

-50

Invalid parameter specified

cantDoThatInCurrentMode

-9402

Request invalid in current mode

SEE ALSO

You report whether your channel's data is organized into frames in your response to the SGGetChannelInfo function, which is described on SGGetChannelInfo .

SGGetChannelMaxFrames

The SGGetChannelMaxFrames function allows the sequence grabber component to determine the number of frames left to be captured from your channel.

pascal ComponentResult SGGetChannelMaxFrames (SGChannel c,
                                          long *frameCount);
c
Identifies the channel connection for this operation.

frameCount
Contains a pointer to a long integer that is to receive a value specifying the number of frames left to be captured during the preview or record operation. If the returned value is -1, the sequence grabber channel component captures as many frames as it can.

RESULT CODE

seqGrabInfoNotAvailable

-9407

Channel component cannot support request

SEE ALSO

The sequence grabber component sets the starting value by calling the SGSetChannelMaxFrames function, which is described in the previous section.

SGSetChannelRefCon

The SGSetChannelRefCon function allows the sequence grabber component to set the value of a reference constant that your component passes to its callback functions.

pascal ComponentResult SGSetChannelRefCon (SGChannel c,
                                          long refCon);
c
Identifies the channel connection for this operation.

refCon
Specifies a reference constant value that your component should pass to the callback functions that have been assigned to this channel.

DESCRIPTION

Sound channels do not support callback functions.

SEE ALSO

See "Using Callback Functions for Video Channel Components," which begins on Using Utility Functions for Video Channel Component Callback Functions , for a description of the callback functions that are supported by video channel components.

SGGetDataRate

The sequence grabber component calls your component's SGGetDataRate function in order to determine how much recording time is left. The sequence grabber calls your component when an application calls the sequence grabber component's SGGetTimeRemaining function (see the chapter "Sequence Grabber Components" in this book for details) .

pascal ComponentResult SGGetDataRate (SGChannel c,
                                         long *bytesPerSecond);
c
Identifies the channel connection for this operation.

bytesPerSecond
Contains a pointer to a long integer that is to receive a value indicating the number of bytes your component is recording per second. Your component calculates this value based on its current operational parameters.

DESCRIPTION

Your component should calculate and return a value indicating the number of bytes of data your component is recording per second. The sequence grabber component uses this information, along with similar information gathered from other channels being used in the recording operation, to determine how many seconds of data may be recorded given the amount of space remaining.

SPECIAL CONSIDERATIONS

The sequence grabber component calls the SGGetDataRate function during the recording operation. Consequently, your component should service the request as quickly as possible.

SGGetChannelSampleDescription

The SGGetChannelSampleDescription function allows the sequence grabber to retrieve your channel's sample description.

pascal ComponentResult SGGetChannelSampleDescription
                                         (SGChannel c, Handle sampleDesc);
c
Identifies the channel connection for this operation.

sampleDesc
Specifies a handle that is to receive your sample description.

DESCRIPTION

The SGGetChannelSampleDescription function allows the sequence grabber to retrieve your channel's current sample description. The sequence grabber may call this function only when your channel is prepared to record or is actually recording.

Your channel returns a sample description that is appropriate to the type of data being captured. For video channels, your channel component returns an Image Compression Manager image description structure; for sound channels, you return a sound description structure, as defined by the Movie Toolbox.

RESULT CODE

cantDoThatInCurrentMode

-9402

Request invalid in current mode

SGGetChannelTimeScale

The SGGetChannelTimeScale function allows the sequence grabber to retrieve your channel's time scale.

pascal ComponentResult SGGetChannelTimeScale (SGChannel c,
                                          TimeScale *scale);
c
Identifies the channel connection for this operation.

scale
Contains a pointer to a time scale structure. Your channel component places information about its time scale into this structure.

DESCRIPTION

The time scale you return typically corresponds to the time scale of the media that has been created by your channel. Applications may use this time scale in their data functions (see the chapter "Sequence Grabber Components" in this book for more information about application-defined data functions).

SGSetChannelClip

The SGSetChannelClip function allows the sequence grabber to set your channel's clipping region.

pascal ComponentResult SGSetChannelClip (SGChannel c,
                                          RgnHandle theClip);
c
Identifies the channel connection for this operation.

theClip
Contains a handle to the new clipping region. You should make a copy of this region; the application may dispose of the region immediately.

If this parameter is set to nil , remove the current clipping region.

DESCRIPTION

The SGSetChannelClip function allows the sequence grabber to apply a clipping region to your channel's display region. By default, channel components do not apply a clipping region to their displayed image.

SGGetChannelClip

The SGGetChannelClip function allows the sequence grabber to retrieve your channel's clipping region.

pascal ComponentResult SGGetChannelClip (SGChannel c,
                                         RgnHandle *theClip);
c
Identifies the channel connection for this operation.

theClip
Contains a pointer to a handle that is to receive the clipping region. The application is responsible for disposing of this handle. If there is no clipping region, set this handle to nil .

Note
Some devices may not support clipping.

SGSetChannelMatrix

The SGSetChannelMatrix function allows the sequence grabber to set your channel's display transformation matrix.

pascal ComponentResult SGSetChannelMatrix (SGChannel c,
                                         const MatrixRecord *m);
c
Identifies the channel connection for this operation.

m
Contains a pointer to a matrix structure, as defined by the Movie Toolbox (see the chapter "Movie Toolbox" in Inside Macintosh: QuickTime for more information about matrix structures). This parameter is set to nil to select the identity matrix.

DESCRIPTION

The SGSetChannelMatrix function allows the sequence grabber to specify a display transformation matrix for a video channel. Your channel uses this matrix to transform its video image into the destination window. If your channel cannot accommodate the matrix, return an appropriate result code. Note that the sequence grabber may not call this function when you are recording.

Other channel component functions may affect this matrix. The SGSetChannelBounds function sets the matrix values so that the matrix maps the channel's output to the channel's boundary rectangle (described on SGSetChannelBounds ). The SGSetVideoRect function modifies the matrix so that the specified video rectangle appears in the existing destination rectangle (see SGSetVideoRect for more information about the SGSetVideoRect function).

RESULT CODES

matrixErr

-2203

Invalid matrix

deviceCantMeetRequest

-9408

Device cannot support grabber

SEE ALSO

The sequence grabber may retrieve your channel's matrix by calling the SGGetChannelMatrix function, which is discussed next.

SGGetChannelMatrix

The SGGetChannelMatrix function allows the sequence grabber to retrieve your channel's display transformation matrix.

pascal ComponentResult SGGetChannelMatrix (SGChannel c,
                                          MatrixRecord *m);
c
Identifies the channel connection for this operation.

m
Contains a pointer to a matrix structure, as defined by the Movie Toolbox (see "Movie Toolbox" in Inside Macintosh: QuickTime for more information about matrix structures). Place your current matrix values into this matrix structure.

SEE ALSO

The sequence grabber may set your channel's matrix by calling the SGSetChannelMatrix function, which is discussed in the previous section.


© 1999 Apple Computer, Inc.

Previous | Overview | Contents | Next